<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateItemImagesTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('item_images', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 100);
            $table->string('file_path', 255);
            $table->string('file_name', 255);
            $table->string('url', 255);
            $table->integer('user_id');
            $table->integer('item_id');
            $table->timestamps();
            $table->index(['user_id', 'item_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('item_images');
    }

}
